package com.example.houduan.Mapper;

import com.example.houduan.Pojo.Doctor;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DoctorMapper {

    @Select("select * from doctor inner join doctor_level on doctor_level.id = doctor.level_id inner join treat_type on doctor.type_id = treat_type.id")
    List<Doctor> selectAllDoctor();

    @Select("select count(*) from doctor ")
    int selectDoctorCount();

    @Select("select * from doctor inner join doctor_level on doctor_level.id = doctor.level_id inner join treat_type on doctor.type_id = treat_type.id limit #{b},#{e}")
    List<Doctor> selectDoctorLimit(int b,int e);

    List<Doctor> selectDoctorByConditions(String name,Integer sex,Integer level_id,String hospital);

    @Insert("insert into doctor values (#{id},#{name},#{age},#{sex},#{level_id},#{phone},#{type_id},#{hospital},#{updatetime},#{createtime},#{account_id})")
    int insertDoctor(Doctor doctor);

    @Update("update doctor set name=#{name},age=#{age},sex=#{sex},level_id=#{level_id},phone=#{phone},type_id=#{type_id},hospital=#{hospital},createtime=#{createtime} where id=#{id}")
    int updateDoctor(Doctor doctor);

    @Delete("delete from doctor where id=#{id}")
    int deleteDoctor(int id);
}
